import { Injectable } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';
import cluster from 'cluster';

@Injectable()
export class TasksService {
    constructor() {
    }
    
    // 重置卡密每日解析次数
    @Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT, {
        timeZone: 'Asia/Shanghai',
    }) // 每天的 00:00 执行定时任务
    async resetPanCodeParseNum() {
        if (!cluster.isPrimary) return;
        console.log('卡密每日解析次数，已重置...');
        
    }
    
    @Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT, {
        timeZone: 'Asia/Shanghai',
    }) // 每天的 00:00 执行定时任务
    // @Timeout(5000)
    async resetSvipAccount() {
        if (!cluster.isPrimary) return;
        
    }
}